<!doctype html>
<html lang="en">
<head>
    @include('wap.layout.head')
    <link rel="stylesheet" href="{{asset('/css/wap/stock.css')}}">
    <!-- <link rel="stylesheet" href="{{asset('/js/web/frame/imgUp/css/imgup1.css')}}"> -->
    <link rel="stylesheet" href="{{asset('/js/wap/frame/common.css')}}">
    <script src="{{asset('/frame/city.data.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('/frame/city.data-3.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('/frame/mui.picker.js')}}"></script>
    <script src="{{asset('/frame/mui.poppicker.js')}}"></script>
    <link href="{{asset('/frame/mui.picker.css')}}" rel="stylesheet" />
    <link href="{{asset('/frame/mui.poppicker.css')}}" rel="stylesheet" />
    <!-- <link src="{{asset('/js/wap/frame/imgUp/js/alertPopShow.js')}}"> -->

</head>
<body>
	<div class="message">
		<ul>
			<li class="mag stock_msg">库存信息</li>
			<li class="mag want_msg">求购信息</li>
		</ul>
		<div class="stock" id="B1" style="display: block;">
			<!-- <div class="img_box"></div> -->
			 <!--图片选择对话框-->
			<!-- <div id="div_imgfile">+增加多张图片 -->
			<!--图片预览容器-->
				<!-- <div id="div_imglook" style="width: 100%;background: #fff;">
					<div style="clear: both;"></div>
				</div> -->
			<!-- </div> -->
			<!-- <input type="button" value="确定上传" id="btn_ImgUpStart" /> -->
            <div class="img_box">
                <ul class="upload-ul clearfix">
                    <li class="upload-pick">
                        <!-- 上传多张图片 -->
                        <div class="webuploader-container clearfix" id="goodsUpload" multiple ="3"></div>
                    </li>
                </ul>
            </div>
			<textarea name="" class="speak" placeholder="请详细的描述一下你甩货的产品，如规格、品牌和型号"></textarea>
			<div class="plane">
				<input type="checkbox" class="input_check allcheck" id="check1" value="1"><label for="check1"></label>加入委托甩货计划
				<p class="sev">e井客服会主动联系你，并提供全面专业的甩货服务支持</p> 
			</div>
			<a href="" class="give">委托人工甩货&nbsp;></a>
        	<div class="screen_box fl"  id="showCityPicker3">
	            <div class="start">发货地</div>
	            <font>〉</font>
	            <span id='cityResult3'>选择</span>
	            <input type="hidden" name="start" id="start" value="">
        	</div>
        	<div class="class_box fl" id="class">
		        <div class="tit">分类</div>
		        <font>〉</font>
		        <div class="choice_right fr" id="class_choice">选择</div>
		        <input type="hidden" name="class" value="">
		    </div>
		    <div class="brand_box fl" id="brand">
		        <div class="tit">品牌</div>
		        <font>〉</font>
		        <div class="choice_right fr" id="brand_choice">选择</div>
		        <input type="hidden" name="brand" value="">
		    </div>
		    <div class="brand_box fl" id="price">
		        <div class="tit">价格</div>
		        <font>〉</font>
		        <div class="choice_right fr" id="price_choice">选择</div>
                <!-- <div class="demo" id="demo4">选择</div> -->
		        <input type="hidden" name="price" value="">
		    </div>
		    <input type="submit" value="立即发布" class="btn_away">
		</div>
		<div class="want" id="B1" style="display: none;">
			<textarea name="" class="describe" placeholder="请详细的描述一下你甩货的产品，如规格、品牌和型号"></textarea>
			<!-- <div class="img_box"></div> -->
			 <!--图片选择对话框-->
			<!-- <div id="div_imgfile">+增加多张图片 -->
			<!--图片预览容器-->
				<!-- <div id="div_imglook" style="width: 100%;background: #fff;">
					<div style="clear: both;"></div>
				</div> -->
			<!-- </div> -->
            <div class="img_box">
                <ul class="upload-ul clearfix">
                    <li class="upload-pick">
                        <!-- 上传多张图片 -->
                        <div class="webuploader-container clearfix" id="goods" multiple ="3"></div>
                    </li>
                </ul>
            </div>
			<!-- <input type="button" value="确定上传" id="btn_ImgUpStart" /> -->
			<a href="" class="give">委托人工甩货&nbsp;></a>
			<div class="screen_box fl"  id="showCityPicker4">
	            <div class="start">收货地</div>
	            <font>〉</font>
	            <span id='cityResult4'>选择</span>
	            <input type="hidden" name="end" id="end" value="">
        	</div>
        	<div class="class_box fl" id="kind">
		        <div class="tit">分类</div>
		        <font>〉</font>
		        <div class="choice_right fr" id="kind_choice">选择</div>
		        <input type="hidden" name="kind" value="">
		    </div>
		    <div class="brand_box fl" id="famous_brand">
		        <div class="tit">品牌</div>
		        <font>〉</font>
		        <div class="choice_right fr" id="famous_choice">选择</div>
		        <input type="hidden" name="famous" value="">
		    </div>
		    <div class="sign_up fl" id="sign">
		        <div class="tit">报名截止</div>
		        <font>〉</font>
		        <div class="choice_right fr" id="sign_choice">选择</div>
		        <input type="hidden" name="sign" value="">
		    </div>
		    <input type="submit" value="立即发布" class="btn_go">
		</div>
	</div>
<!-- <script src="{{asset('/js/web/frame/imgUp/js/jquery-1.10.2.js')}}"></script>
<script src="{{asset('/js/web/frame/imgUp/js/jquery-migrate-1.2.1.min.js')}}"></script>
<script src="{{asset('/js/web/frame/imgUp/js/imgup1.js')}}"></script> -->
<script src="{{asset('/js/wap/frame/imgUp/js/webuploader.min.js')}}"></script>
<script src="{{asset('/js/wap/frame/imgUp/js/diyUpload.js')}}"></script>
<script src="{{asset('/js/wap/frame/alertPopShow.js')}}"></script>
<script type="text/javascript">
    $(function(){
    	$("ul .mag").click(function(){
	        $(".message")
	        .children("#B1").eq($(this).index())
	        .show()
	        .siblings("#B1")
	        .hide()
    	})
	    $("ul .mag")
	    .on("click",function(){
	        $(this)
	        .css({"border-bottom":"2px solid #0483db"})
	        .css({"color":"#47a4e5"})
	        .siblings()
	        .css({"border":"0"})
	        .css({"color":"#000"})
	    })
	    // 库存信息
        //上传图片
        var $tgaUpload = $('#goodsUpload').diyUpload({
            url:'/uploadFilePath',
            auto:true,
            success:function( data ) { },
            error:function( err ) { },
            buttonText : '',
            accept: {
                title: "Images",
                extensions: 'gif,jpg,jpeg,bmp,png'
            },
            thumb:{
                width:120,
                height:90,
                quality:100,
                allowMagnify:true,
                crop:true,
                type:"image/jpeg"
            }
        });
		//收货地址选择
        var doc = document;
        var cityPicker3 = new mui.PopPicker({
            layer: 3,
	        titles: ["省", "市", "区"]
        });
        cityPicker3.setData(cityData3);
        var showCityPickerButton = doc.getElementById('showCityPicker3');
        var cityResult3 = doc.getElementById('cityResult3');
        showCityPickerButton.addEventListener('tap', function (event) {
            cityPicker3.show(function (items) {
                cityResult3.innerText = (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
	                doc.getElementById("start").setAttribute("value", (items[0] || {}).value + "-" + (items[1] || {}).value + "-" + (items[2] || {}).value);
            });
        }, false);
        //分类
        var classfiyTypePicker = new mui.PopPicker({
            layer: 1,
            titles: ["分类"]
        });
        classfiyTypePicker.setData([{
                        value: '视频监控',
                        text: '视频监控'
                    }, {
                        value: '硬盘',
                        text: '硬盘'
                    }, {
                        value: '辅材',
                        text: '辅材'
                    }, {
                        value: '其他',
                        text: '其他'
                    }]);
        var showClassTypeButton = doc.getElementById('class');
        var classfiyResult = doc.getElementById('class_choice');
        showClassTypeButton.addEventListener('tap', function (event) {
            classfiyTypePicker.show(function (items) {
                classfiyResult.innerText = items[0].text;
                $("input[name='class']").val(items[0].text)
            });
        }, false);
        //品牌
        var brandTypePicker = new mui.PopPicker({
            layer: 1,
            titles: ["品牌"]
        });
        brandTypePicker.setData([{
                        value: '海康威视',
                        text: '海康威视'
                    }, {
                        value: '大华',
                        text: '大华'
                    }, {
                        value: '宇视',
                        text: '宇视'
                    }, {
                        value: '华三',
                        text: '华三'
                    }]);
        var showBrandButton = doc.getElementById('brand');
        var brandResult = doc.getElementById('brand_choice');
        showBrandButton.addEventListener('tap', function (event) {
            brandTypePicker.show(function (items) {
                brandResult.innerText = items[0].text;
                $("input[name='brand']").val(items[0].text)
            });
        }, false);
       //价格
        $('#price_choice').on('click', function(){
            var price = $("#price_choice");
            // console.log(price);
            var html = "<label>原价：<input class='confirm_input' placeholder='必填'></label><br><label>售价：<input class='confirm_input' placeholder='必填'></label>";
            popTipShow.confirm('商品报价',html,['确认','取 消'],
                function(e){
                  //callback 处理按钮事件
                  var button = $(e.target).attr('class');
                  if(button == 'ok'){
                    if(null==$(".confirm_input").val() || ""==$(".confirm_input").val()){
                        webToast("原价不能为空！","bottom", 3000);
                        return;
                    }   
                    this.hide();
                    price.html($('.confirm_input').val());
                    $("input[name='price']").val($('.confirm_input').val());
                  }
                  if(button == 'cancel') {
                    this.hide();
                  }
                }
            );
       });
        $('.btn_away').click(function () {
            var ids = '';//店铺权限
            $('.input_check').each(function(index, el){
                if ($(this).is(":checked")) {
                    ids +=$(this).val()+",";
                }
            })
            if(ids == ''){
                layer.msg("请勾选加入委托甩货计划",{time:1000});
                return false;
            }
        	var speak = $(".speak").val();
        	if(speak == ''){
	            layer.msg("请详细描述您的产品",{time:1000});
	            return false;
	        }
	        var start = $('input[name="start"]').val();
	        if(start == ''){
	            layer.msg("请填写发货地",{time:1000});
	            return false;
	        }
	        var class_kind = $('input[name="class"]').val();
	        if(class_kind == ''){
	            layer.msg("请选择分类",{time:1000});
	            return false;
	        }
	        var brand = $('input[name="brand"]').val();
	        if(brand == ''){
	            layer.msg("请选择品牌",{time:1000});
	            return false;
	        }
            var perice = $("input[name='price']").val();
            console.log()
            if(perice == ''){
                layer.msg("请填写价格",{time:1000});
                return false;
            }
            // console.log(ids,speak,start,class_kind,brand,perice)
            $.ajax({
                url:"",
                type: 'post',
                data:'',
                dataType: 'json',
                success:function(data){
                    if(data.code==0){
                        
                    }else{
                        
                    }
                }
            })
    	})
        // 求购信息
        //发货地
        //上传图片
        var $tgaUpload = $('#goods').diyUpload({
            url:'/uploadFilePath',
            auto:true,
            success:function( data ) { },
            error:function( err ) { },
            buttonText : '',
            accept: {
                title: "Images",
                extensions: 'gif,jpg,jpeg,bmp,png'
            },
            thumb:{
                width:120,
                height:90,
                quality:100,
                allowMagnify:true,
                crop:true,
                type:"image/jpeg"
            }
        });
        var doc = document;
        var cityPicker4 = new mui.PopPicker({
            layer: 3,
	        titles: ["省", "市", "区"]
        });
        cityPicker4.setData(cityData3);
        var showCity1PickerButton = doc.getElementById('showCityPicker4');
        var cityResult4 = doc.getElementById('cityResult4');
        showCity1PickerButton.addEventListener('tap', function (event) {
            cityPicker4.show(function (items) {
                cityResult4.innerText = (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
	                doc.getElementById("end").setAttribute("value", (items[0] || {}).value + "-" + (items[1] || {}).value + "-" + (items[2] || {}).value);
            });
        }, false);
        //分类
        var kindTypePicker = new mui.PopPicker({
            layer: 1,
            titles: ["分类"]
        });
        kindTypePicker.setData([{
                        value: '视频监控',
                        text: '视频监控'
                    }, {
                        value: '硬盘',
                        text: '硬盘'
                    }, {
                        value: '辅材',
                        text: '辅材'
                    }, {
                        value: '其他',
                        text: '其他'
                    }]);
        var showKindTypeButton = doc.getElementById('kind');
        var kindResult = doc.getElementById('kind_choice');
        showKindTypeButton.addEventListener('tap', function (event) {
            kindTypePicker.show(function (items) {
                kindResult.innerText = items[0].text;
                $("input[name='kind']").val(items[0].text)
            });
        }, false);
        //品牌
        var famousPicker = new mui.PopPicker({
            layer: 1,
            titles: ["品牌"]
        });
        famousPicker.setData([{
                        value: '海康威视',
                        text: '海康威视'
                    }, {
                        value: '大华',
                        text: '大华'
                    }, {
                        value: '宇视',
                        text: '宇视'
                    }, {
                        value: '华三',
                        text: '华三'
                    }]);
        var showFamousButton = doc.getElementById('famous_brand');
        var famousResult = doc.getElementById('famous_choice');
        showFamousButton.addEventListener('tap', function (event) {
            famousPicker.show(function (items) {
                famousResult.innerText = items[0].text;
                $("input[name='famous']").val(items[0].text)
            });
        }, false);
        //报名截止
        var signPicker = new mui.PopPicker({
            layer: 1,
            titles: ["报名截止"]
        });
        signPicker.setData([{
                        value: '3天截止',
                        text: '3天截止'
                    }, {
                        value: '7天截止',
                        text: '7天截止'
                    }, {
                        value: '15天截止',
                        text: '15天截止'
                    }, {
                        value: '长期有效',
                        text: '长期有效'
                    }]);
        var showSignButton = doc.getElementById('sign');
        var signResult = doc.getElementById('sign_choice');
        showSignButton.addEventListener('tap', function (event) {
            signPicker.show(function (items) {
                signResult.innerText = items[0].text;
                $("input[name='sign']").val(items[0].text)
            });
        }, false);
        $('.btn_go').click(function () {
        	var describe = $(".describe").val();
        	if(describe == ''){
	            layer.msg("请详细描述您的产品",{time:1000});
	            return false;
	        }
	        var end = $('input[name="end"]').val();
            if(end == ''){
                layer.msg("请填写收货地",{time:1000});
                return false;
            }
	        var class_kind = $('input[name="kind"]').val();
	        if(class_kind == ''){
	            layer.msg("请选择分类",{time:1000});
	            return false;
	        }
	        var famous = $('input[name="famous"]').val();
	        if(famous == ''){
	            layer.msg("请选择品牌");
	            return false;
	        }
	        var time = $('input[name="sign"]').val();
	        if(time == ''){
	            layer.msg("请选择截止时间",{time:1000});
	            return false;
	        }
            // console.log(describe,end,class_kind,famous,time)
            $.ajax({
                url:"",
                type: 'post',
                data:'',
                dataType: 'json',
                success:function(data){
                    if(data.code==0){
                        
                    }else{

                    }
                }
            })
    	})
    })
</script>
</body>
</html>